package com.heyqing.ems.controller;

import com.heyqing.ems.po.ModifyPo;
import com.heyqing.ems.po.OpManagerPo;
import com.heyqing.ems.po.QueryPo;
import com.heyqing.ems.service.BossService;
import com.heyqing.ems.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName:BossController
 * Package:com.heyqing.ems.controller
 * Description:
 *
 * @Date:2024/6/26
 * @Author:Heyqing
 */
@Api(value = "老板")
@RestController
@RequestMapping("boss")
@RequiredArgsConstructor
public class BossController {

    private final BossService bossService;

    /**
     * 列表查询
     *
     * @param queryPo
     * @return
     */
    @ApiOperation("查询列表")
    @PostMapping("list")
    public Result list(@RequestBody QueryPo queryPo) {
        return bossService.getList(queryPo);
    }

    /**
     * 添加/修改经理
     *
     * @param opManagerPo
     * @return
     */
    @ApiOperation("添加/修改经理")
    @PutMapping("save")
    public Result saveManger(@RequestBody OpManagerPo opManagerPo) {
        return bossService.saveManger(opManagerPo);
    }


    @ApiOperation("添加/修改经理密码")
    @PutMapping("modify")
    public Result modify(@RequestBody ModifyPo modifyPo) {
        return bossService.modify(modifyPo);
    }

    @ApiOperation("删除经理")
    @DeleteMapping("delete/{id}")
    public Result deleteManger(@PathVariable Long id) {
        return bossService.delete(id);
    }

}
